<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%-- addRoute.jsp --%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<html>
<head>
    <title>添加旅游路线</title>
    <!-- 复用原有样式 -->
    <style>
        /* 复用route.jsp中的样式 */
        .form-container {
            max-width: 800px;
            margin: 30px auto;
            padding: 25px;
            background: #fff;
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        }

        .form-group {
            margin-bottom: 20px;
            display: flex;
            align-items: center;
        }

        .form-label {
            width: 120px;
            font-weight: 500;
            color: #333;
        }

        .form-input {
            flex: 1;
            padding: 8px 15px;
            border: 2px solid #dee2e6;
            border-radius: 4px;
        }

        /* 新增按钮样式 */
        .form-actions {
            display: flex;
            gap: 20px;
            justify-content: center;
            margin-top: 40px;
        }

        .action-btn {
            padding: 12px 35px;
            font-size: 16px;
            border-radius: 25px; /* 圆角与搜索按钮一致 */
            transition: all 0.3s ease;
            text-transform: uppercase; /* 字母大写 */
            letter-spacing: 1px;
            border: none;
            cursor: pointer;
        }

        /* 提交按钮 */
        .edit-btn {
            background: #4CAF50;
            box-shadow: 0 4px 6px rgba(76, 175, 80, 0.2);
        }

        .edit-btn:hover {
            background: #43A047;
            transform: translateY(-2px);
            box-shadow: 0 6px 8px rgba(76, 175, 80, 0.3);
        }

        /* 取消按钮 */
        .delete-btn {
            background: #f44336;
            box-shadow: 0 4px 6px rgba(244, 67, 54, 0.2);
        }

        .delete-btn:hover {
            background: #E53935;
            transform: translateY(-2px);
            box-shadow: 0 6px 8px rgba(244, 67, 54, 0.3);
        }

        /* 响应式调整 */
        @media (max-width: 768px) {
            .form-actions {
                flex-direction: column;
            }
            .action-btn {
                width: 100%;
                padding: 14px;
            }
        }
    </style>
</head>
<body>
<div class="form-container">
    <h2 style="color: #4CAF50; text-align: center;">添加新路线</h2>

    <form action="${pageContext.request.contextPath}/insertRoute" method="post" enctype="multipart/form-data">
        <!-- 基础信息 -->
        <div class="form-group">
            <label class="form-label">路线名称：</label>
            <input type="text" name="route_name" class="form-input" required>
        </div>

        <div class="form-group">
            <label class="form-label">出发地：</label>
            <input type="text" name="route_star" class="form-input" required>
        </div>

        <div class="form-group">
            <label class="form-label">目的地：</label>
            <input type="text" name="route_end" class="form-input" required>
        </div>

        <!-- 其他字段 -->
        <div class="form-group">
            <label class="form-label">价格：</label>
            <input type="number" name="route_price" class="form-input" step="0.01" required>
        </div>

        <div class="form-group">
            <label class="form-label">行程天数：</label>
            <input type="number" name="route_days" class="form-input" required>
        </div>

        <!-- 分类选择 -->
        <div class="form-group">
            <label class="form-label">分类栏目：</label>
            <select name="cla_id" class="form-input" required>
                <c:forEach items="${classIfs}" var="classif">
                    <option value="${classif.classif_id}" name="cla_id">${classif.classif_name}</option>
                </c:forEach>
            </select>
        </div>

        <!-- 供应商选择 -->
        <div class="form-group">
            <label class="form-label">供应商：</label>
            <select name="gy_id" class="form-input" required>
                <c:forEach items="${suppliers}" var="supplier">
                    <option value="${supplier.supplier_id}" name="gy_id">${supplier.supplier_name}</option>
                </c:forEach>
            </select>
        </div>

        <!-- 图片上传 -->
        <div class="form-group">
            <label class="form-label">路线图片：</label>
            <input type="file" name="image" class="form-input" required>
        </div>

        <!-- 其他字段 -->
        <div class="form-group">
            <label class="form-label">热点路线：</label>
            <select name="route_on" class="form-input">
                <option value="1">是</option>
                <option value="0">否</option>
            </select>
        </div>

        <div class="form-group">
            <label class="form-label">线路介绍：</label>
            <textarea name="route_js" class="form-input" rows="4" required></textarea>
        </div>

        <div class="form-actions">
            <button type="submit" class="action-btn edit-btn">
                <i class="fas fa-plus-circle"></i> 提交创建
            </button>
            <a href="${pageContext.request.contextPath}/routeCha"
               class="action-btn delete-btn">
                <i class="fas fa-times-circle"></i> 取消返回
            </a>
        </div>
    </form>
</div>
</body>
</html>
